<?php

/**
 * Turma form base class.
 *
 * @package    form
 * @subpackage turma
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseTurmaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_turma'   => new sfWidgetFormInputHidden(),
      'nm_turma'   => new sfWidgetFormInput(),
      'nu_turma'   => new sfWidgetFormInput(),
      'ds_turma'   => new sfWidgetFormInput(),
      'st_turma'   => new sfWidgetFormInput(),
      'slug'       => new sfWidgetFormInput(),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
      'deleted'    => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id_turma'   => new sfValidatorDoctrineChoice(array('model' => 'Turma', 'column' => 'id_turma', 'required' => false)),
      'nm_turma'   => new sfValidatorString(array('max_length' => 50)),
      'nu_turma'   => new sfValidatorInteger(),
      'ds_turma'   => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'st_turma'   => new sfValidatorString(array('max_length' => 1)),
      'slug'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at' => new sfValidatorDateTime(array('required' => false)),
      'updated_at' => new sfValidatorDateTime(array('required' => false)),
      'deleted'    => new sfValidatorBoolean(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'Turma', 'column' => array('slug')))
    );

    $this->widgetSchema->setNameFormat('turma[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Turma';
  }

}
